<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>tiff</title>
    <script src="./tiff.js/tiff.min.js"></script>
  </head>
  <body>
    <div id="box">
        <img style="width: 400px; height: 400px;" alt="" />
    </div>
    
    <input id="range" type="range" min="0" max="10" value="0">
    <script>
      window.onload = function() {
        getTiffDataUrlHandler();
      };
      async function getTiffDataUrlHandler() {
        const response = await fetch("http://localhost:3000/th.tif");
        const buffer = await response.arrayBuffer();
        const tiff = new Tiff({ buffer });
        const img = document.querySelector("img");
        img.src = tiff.toDataURL();
        console.log(console.log(tiff.toDataURL()));
      }

      let rangeInput = document.getElementById("range")
      let box = document.getElementById("box")
      rangeInput.addEventListener('change',function () {
        box.style.filter = "blur(" + rangeInput.value + "px)"
      })
    </script>
  </body>
</html>
